import instance from '@/utils/request'
import Qs from 'qs'
/**
 * 分页查询
 */
export const sysdictPage = (entity) => {
  return instance.get('/sysdict/page?' + Qs.stringify(entity))
}

/**
 * 根据 code 查询 对象
 */
export const sysdictgetById = (code) => {
  return instance.get('/sysdict/getById?' + Qs.stringify(code))
}

/**
 * 新增
 */
export const sysdictSave = (entity) => {
  return instance.post('/sysdict/save', Qs.stringify(entity))
}

/**
 * 修改
 */
export const sysdictUpdateById = (entity) => {
  return instance.post('/sysdict/updateById', Qs.stringify(entity))
}

/**
 * 批量删除
 */
export const sysdictBatchDelete = (codes) => {
  return instance.get('/sysdict/deletes?codes=' + codes)
}

/**
 * 根据code删除
 */
export const sysdictRemoveById = (code) => {
  return instance.get('/sysdict/removeById?code=' + code)
}

/**
 * 根据 code 修改 状态
 */
export const updateEnableByCode = (code, enable) => {
  return instance.get(`/sysdict/updateEnableByCode?code=${code}&enable=${enable}`)
}

/**
 *获取字典管理 tree树
 */
export const getSysDictListTree = () => {
  return instance.get(`/sysdict/getSysDictListTree`)
}

/**
 * 根据 parentCode 查询 list
 */
export const getListByParentCode = (parentCode) => {
  return instance.get(`/sysdict/getListByParentCode?parentCode=${parentCode}`)
}

export const getSysConfig = ()=> instance.get(`/sysdict/getSysConfig`)
